<template>
    <div class="supplierList">
        <el-table ref="multipleTable" :data="tableData" tooltip-effect="dark"
            style="width: 100%" @selection-change="handleSelectionChange">
            <el-table-column type="selection" width="35">
            </el-table-column>
            <el-table-column prop="type" label="类型" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="name" label="供应商名称" width="120">
            </el-table-column>
            <el-table-column prop="level" label="级别" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="employeeNum" label="员工数量" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="province" label="省市" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="address" label="详细地址" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="content" label="联系人" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="head" label="负责人" show-overflow-tooltip>
            </el-table-column>
            <el-table-column label="创建时间" width="120">
                <template slot-scope="scope">{{ scope.row.date }}</template>
            </el-table-column>
            <el-table-column prop="address" label="跟进" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="product" label="产品" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="status" label="状态" show-overflow-tooltip>
                <template slot-scope="scope">
                    <el-tag disable-transitions type="success"
                        v-if="scope.row.state == '有效'">{{
                            scope.row.state
                        }}</el-tag>
                    <el-tag disable-transitions type="info"
                        v-if="scope.row.state == '无效'">{{
                            scope.row.state
                        }}</el-tag>
                </template>
            </el-table-column>
            <el-table-column fixed="right" label="操作" align="center" width="180">
                <template slot-scope="scope">
                    <el-button type="primary" size="mini"
                        @click="goChange(scope.row.id)">
                        修改
                    </el-button>
                    <el-button type="danger" size="mini"
                        @click="deleteSupplier(scope.row.id)">
                        删除
                    </el-button>
                </template>
            </el-table-column>
        </el-table>
        <!-- 分页器 -->
        <Pagination :total="total" :pageSize="pageSize" @getPagination="getPagination"></Pagination>
    </div>
</template>

<script>

import Pagination from '@/components/Pagination'
export default {
    name: '',
    data() {
        return {
            //分页器
            total:10,
            pageSize:10,
            //列表数据
            tableData:
                [{
                    id: 1,
                    date: '2016-05-03',
                    name: '王小虎',
                    address: '上海市普陀区金沙江路 1518 弄',
                    state: '有效'
                }, {
                    id: 2,
                    date: '2016-05-02',
                    name: '王小虎',
                    address: '上海市普陀区金沙江路 1518 弄',
                    state: '无效'
                }
                ],
            multipleSelection: []

        }
    },
    components: {
        Pagination
    },
    created(){
        this.getSupperList()
    },
    methods: {
        //--------------获取点击的页码
        getPagination(page) {
              console.log('----',page);
          //  this.getSupplierList(page)
        },
        //---------------获取订单列表
        async getSupperList(page){
           console.log(this.$api.supply);
        },
        //列表单选多选
        handleSelectionChange(val) {
            this.multipleSelection = val;
            this.$emit('pushData',this.multipleSelection)
        },
        //进入修改页面
        goChange(id) {
            this.$router.push('/supply/supManage/editSupplier')
        },
        //删除供应商
        deleteSupplier(id) {
            this.$confirm('此操作将删除该供应商, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                this.$message({
                    type: 'success',
                    message: '删除成功!'
                });
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消删除'
                });
            });
        },

    },
}



</script>

<style lang="less" scoped></style>